package com.iot.common.enums;

public enum BizCode {

    SUBSCRIBE("subscribe", "添加订阅"),
    UNSUBSCRIBE("unsubscribe", "移除订阅"),
    PUBLISH("publish", "发布消息"),
    COMMON("common", "普通消息"),
    ;

    private String code;
    private String dscr;

    BizCode(String code, String dscr) {
        this.code = code;
        this.dscr = dscr;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDscr() {
        return dscr;
    }

    public void setDscr(String dscr) {
        this.dscr = dscr;
    }

    public static BizCode fromCode(String value) {
        for (BizCode b : BizCode.values()) {
            if (b.code.equals(value)) {
                return b;
            }
        }
        return null;
    }
}
